//package org.ricks.orm.mongodb.asm;
//
//import org.ricks.common.asm.*;
//import org.ricks.common.utils.ClassUtils;
//
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.lang.invoke.MethodHandles;
//import java.util.Objects;
//
///**
// * @Author ricks [chenwei]
// * @Version [v1.0]
// * @CreateTime 2024-06-17   11:02
// * @Description TODO
// */
//
//public class FieldCallPrinter {
//
//    private static final MethodHandles.Lookup lookup = MethodHandles.lookup();
//
//    public static void main(String[] args) throws IOException, IllegalAccessException {
//        String path = Objects.requireNonNull(HelloWorldTransformCore.class.getResource("")).getPath();
//        System.err.println(path);
//
//        String relative_path = path + "User.class";
//        FileInputStream fileInputStream = new FileInputStream(relative_path);
//        ClassReader cr = new ClassReader(fileInputStream); // 替换为你的类名
//        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
//        ClassVisitor cv = new ClassVisitor(Opcodes.ASM9, cw) {
//            @Override
//            public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
//                MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions);
//                return new MethodVisitor(Opcodes.ASM9, mv) {
//                    @Override
//                    public void visitFieldInsn(int opcode, String owner, String name, String descriptor) {
//                        System.out.println("Field " + name + " is accessed with opcode " + opcode);
//                        super.visitFieldInsn(opcode, owner, name, descriptor);
//                    }
//                };
//            }
//        };
//        cr.accept(cv, ClassReader.SKIP_DEBUG);
//
//        //（5）生成byte[]
//        byte[] bytes2 = cw.toByteArray();
//
//        Class<User> klass = (Class< User>) lookup.defineClass(bytes2);
//        User user = ClassUtils.newInstance(klass);
//        FileOutputStream fos = new FileOutputStream("d://user.class");
//        fos.write(bytes2);
//        fos.close();
////        helloWorld.sub(1,2);
//
////        Item item = new Item();
////        item.setItemId(1);
////        item.setCount(1000);
////        user.getMap2();
//    }
//}